package com.codingxyz.simple;

import java.util.WeakHashMap;

public class WeakHashMapDemo {

    public static void main(String[] args) {

        myWeakHamMap();
    }

    private static void myWeakHamMap() {

        WeakHashMap<Integer,String> weakHashMap = new WeakHashMap<>();

        Integer key = new Integer(1);
        String val = "hashMap";
        weakHashMap.put(key,val);

        System.out.println(weakHashMap.toString());

        key= null;
        System.gc();

        System.out.println(weakHashMap.toString());



    }
}
